package Demo01;

import javax.jws.soap.SOAPBinding;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—30
 * Time: 13:40
 */
class UserNameException extends RuntimeException {
    public UserNameException() {

    }
    public UserNameException(String message) {
        super(message);
    }
}
class PasswordException extends RuntimeException {

    public PasswordException() {
    }

    public PasswordException(String message) {
        super(message);
    }
}
public class LogIn {
    private static String uName = "admin";
    private static String pword = "1111";

    public static void loginInfo(String userName, String password) {
        if ( !uName.equals(userName)) {
            throw new UserNameException("用户名错误！");
        }
        if ( !pword.equals(password)) {
            throw new RuntimeException("密码错误！");

        }
        System.out.println("登录成功！");
    }

    public static void main(String[] args) {
        try {
            loginInfo("admin","1111");
        } catch (UserNameException e) {
            e.printStackTrace();
        } catch (PasswordException e) {
            e.printStackTrace();
        }
    }
}
